package com.rd.sys.service.sys.user.impl;

import baseproj.common.exception.BaseServiceException;
import baseproj.inter.Message;

/**
 * The Class UserInfoServiceException.
 */
public class UserSubscriptionServiceException extends BaseServiceException {

    /** The Constant serialVersionUID. */
    private static final long serialVersionUID = 1L;

    public static final int USER_NOT_EXIT = 1;
    public static final int USER_SUB_EXIST = 2;
    public static final int USER_DEVICE_ALREADY_EXIST = 3;
    public static final int SUBSCRIPTION_NOT_NORMAL = 4;
    public static final int SUBSCRIPTION_OVERDUE = 5;
    public static final int SUBSCRIPTION_NOT_USER = 6;

    /**
     * Instantiates a new user info service exception.
     * 
     * @param erroCode
     *            the erro code
     */
    public UserSubscriptionServiceException(int erroCode) {
        super(erroCode);
        if (erroCode == USER_NOT_EXIT) {
            // 用户登录账号名称已存在
            this.setErroDesc(Message.getMessage("user.info.not.exist"));
        }
        if (erroCode == USER_SUB_EXIST) {
            // 用户签约关系已经存在
            this.setErroDesc(Message.getMessage("user.subscription.exist"));
        }
        if (erroCode == USER_DEVICE_ALREADY_EXIST) {
            // 用户设备唯一编号已经存在
            this.setErroDesc(Message.getMessage("user.subscription.device.exist"));
        }
        if (erroCode == SUBSCRIPTION_NOT_NORMAL) {
            // 订购关系状态非正常
            this.setErroDesc("订购关系状态非正常");
        }
        if (erroCode == SUBSCRIPTION_OVERDUE) {
            // 订购关系已过期
            this.setErroDesc("订购关系已过期");
        }
        if (erroCode == SUBSCRIPTION_NOT_USER) {
            // 无该用户的订购关系
            this.setErroDesc("无该用户的订购关系");
        }

    }
}
